﻿using System;

namespace Close2Poco
{
    /// <summary>
    /// Specifies length of strings.  Only needed if you are going to generate the DB from your objects.
    /// Cannot be combined with <see cref="DbTypeAttribute"/>, so use this if you just want to specify string length; use <see cref="DbTypeAttribute"/> if you want to 
    /// specify more than that
    /// </summary>
    public class LengthAttribute:MappingAttribute
    {
        public LengthAttribute(int stringLength)
        {
            Length = stringLength;
        }

        public readonly int Length;

        internal override string GetMappingText()
        {
            return "DbType=\"NVarChar(" + Length + ")\"";
        }
    }
}
